﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ZX.BLL.AuthMgr;
using ZX.BLL;
using ZX.BLL.EHR.Time;
using Ivony.Html;
using Ivony.Html.Parser;

namespace ZX.Test
{
    /// <summary>
    /// BDept 的摘要说明
    /// </summary>
    [TestClass]
    public class DeptTest
    {
        public DeptTest()
        {
            //
            //TODO: 在此处添加构造函数逻辑
            //
        }

        private TestContext testContextInstance;

        /// <summary>
        ///获取或设置测试上下文，该上下文提供
        ///有关当前测试运行及其功能的信息。
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region 附加测试特性
        //
        // 编写测试时，可以使用以下附加特性:
        //
        // 在运行类中的第一个测试之前使用 ClassInitialize 运行代码
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // 在类中的所有测试都已运行之后使用 ClassCleanup 运行代码
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // 在运行每个测试之前，使用 TestInitialize 来运行代码
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // 在每个测试运行完之后，使用 TestCleanup 来运行代码
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        /*
         * declare @EmployeeID uniqueidentifier,@BeginDateTime datetime,@EndDateTime datetime,@TimeLength float,@Msg varchar(4000)
set @EmployeeID='D0BAD961-4C79-42A1-98B4-D3E39271E865'
set @BeginDateTime ='2012-02-12 08:30'
set @EndDateTime ='2012-02-12 18:30'
set @TimeLength=0
set @Msg=''
EXEC sp_HR_GetEmpTotalVation @EmployeeID,@BeginDateTime,@EndDateTime,0,@TimeLength output,@Msg output
Print '@TimeLength:'+ CONVERT(varchar(200),@TimeLength)+'@@@Msg:'+@Msg	

        */

        [TestMethod]
        public void TestLeaveTime()
        {
            ZX.BLL.Extend.BaseBussnies bll = new BLL.Extend.BaseBussnies();
            var dt = bll.GetDataBySqlComm("select * from Category");



            float time = 0.0f;
            string msg = "";
            Ehr_Scheduling obj = new Ehr_Scheduling();
            float day = obj.HRGetEmpTotalVation(new Guid("D0BAD961-4C79-42A1-98B4-D3E39271E865"), Convert.ToDateTime("2013-05-12 08:30"), Convert.ToDateTime("2013-05-17 18:30"), 1, out time, out msg);
        }


        [TestMethod]
        public void TestResumeTemplate()
        {
            string htmlContent = "";
            var doc = new JumonyParser().Parse(htmlContent);
            if (doc != null)
            {
                //resumeInfo = new ResumeParsedInfo();
                var els = doc.Find("td");
                int index = 0;
                IList<Template> list = new List<Template>();
                foreach (var el in doc.Find("td"))
                {

                    Template t = new Template();
                    t.Index = index;
                    t.InnerText = el.InnerText();
                    index = index + 1;
                }
            }
        }

        class Template
        {
            public int Index
            {
                get;
                set;
            }
            public string InnerText
            {
                get;
                set;
            }
        }
        public void TestCopyDept()
        {
            ZX.BLL.BDept bdept = new ZX.BLL.BDept();
            bdept.DeptCopy(new Guid("63B0F4C5-B6CE-49EA-B859-17609E5DD1B6"));
            ZX.BLL.Extend.BaseBussnies bll = new BLL.Extend.BaseBussnies();
            var result =  bll.RunProcedure("sp_GetValueCName", new object[] { DateTime.Parse("2013-01-01"),DateTime.Parse("2013-12-31") });
            //
            // TODO: 在此处添加测试逻辑
            //
            var _result = bll.RunProcedure("sp_GetDicList", new object[] { "TrQuestionnaireType" });
            object[] dr = result.GetRow(0);
            var _result2 = bll.RunProcedure("sp_run_test", new object[] { "TrQuestionnaireType" });
            object[] dr2 = _result2.GetRow(0);
        }
    }
}
